package  gearunits.models {
	import sandy.primitive.Primitive3D;
	import sandy.core.scenegraph.Geometry3D;
	import sandy.core.scenegraph.Shape3D;

	public class SMeshBuildingPowerPlant extends Shape3D implements Primitive3D {
		private var l:Geometry3D;

		private function f(v1:Number,v2:Number,v3:Number,uv00:Number,uv01:Number,uv10:Number,uv11:Number,uv20:Number,uv21:Number,normX:Number,normY:Number,normZ:Number):void {
			var uv1:Number = l.getNextUVCoordID();
			var uv2:Number = uv1 + 1;
			var uv3:Number = uv2 + 1;

			l.setUVCoords(uv1,uv00,1-uv01);
			l.setUVCoords(uv2,uv10,1-uv11);
			l.setUVCoords(uv3,uv20,1-uv21);

			l.setFaceVertexIds(l.getNextFaceID(), v1,v2,v3);
			l.setFaceUVCoordsIds(l.getNextFaceUVCoordID(), uv1,uv2,uv3);
			l.setFaceNormal(l.getNextFaceNormalID(), normX,normZ,normY);
		}

		private function f4(v1:Number,v2:Number,v3:Number,v4:Number,uv00:Number,uv01:Number,uv10:Number,uv11:Number,uv20:Number,uv21:Number,uv30:Number,uv31:Number,normX:Number,normY:Number,normZ:Number):void {
			var uv1:Number = l.getNextUVCoordID();
			var uv2:Number = uv1 + 1;
			var uv3:Number = uv2 + 1;
			var uv4:Number = uv3 + 1;

			l.setUVCoords(uv1,uv00,1-uv01);
			l.setUVCoords(uv2,uv10,1-uv11);
			l.setUVCoords(uv3,uv20,1-uv21);
			l.setUVCoords(uv4,uv30,1-uv31);

			l.setFaceVertexIds(l.getNextFaceID(),v1,v2,v3,v4);
			l.setFaceUVCoordsIds(l.getNextFaceUVCoordID(),uv1,uv2,uv3,uv4);
			l.setFaceNormal(l.getNextFaceNormalID(),normX,normZ,normY);
		}

		private function f2(v1:Number,v2:Number,v3:Number):void {
			l.setFaceVertexIds(l.getNextFaceID(), v1,v2,v3);
		}

		private function v(vx:Number,vy:Number,vz:Number):void {
			l.setVertex(l.getNextVertexID(),vx,vz,vy);
		}

		public function SMeshBuildingPowerPlant( p_Name:String=null ) {
			super( p_Name );
			geometry = generate();
		}

		public function generate(... arguments):Geometry3D {
			l = new Geometry3D();
			v(6.788227,6.788229,-0.300000);
			v(9.600002,0.000003,-0.300000);
			v(6.788227,-6.788222,-0.300000);
			v(0.000001,-9.599997,-0.300000);
			v(-6.788225,-6.788221,-0.300000);
			v(-9.599999,0.000004,-0.300000);
			v(-6.788225,6.788227,-0.300000);
			v(-0.000002,9.600003,-0.300000);
			v(6.788224,6.788232,3.300000);
			v(9.600002,0.000009,3.300000);
			v(6.788229,-6.788220,3.300000);
			v(0.000001,-9.599997,3.300000);
			v(-6.788226,-6.788220,3.300000);
			v(-9.599999,0.000010,3.300000);
			v(-6.788218,6.788235,3.300000);
			v(0.000014,9.600003,3.300000);
			v(0.000001,0.000003,-0.300000);
			v(0.000013,8.640004,5.300000);
			v(-6.109396,6.109413,5.300000);
			v(-8.639999,0.000009,5.300000);
			v(-6.109404,-6.109397,5.300000);
			v(0.000001,-8.639997,5.300000);
			v(6.109406,-6.109398,5.300000);
			v(8.640002,0.000009,5.300000);
			v(6.109402,6.109409,5.300000);
			v(6.109402,6.109409,14.300000);
			v(8.640002,0.000009,14.300000);
			v(6.109406,-6.109398,14.300000);
			v(0.000001,-8.639997,14.300000);
			v(-6.109404,-6.109397,14.300000);
			v(-8.639999,0.000009,14.300000);
			v(-6.109396,6.109413,14.300000);
			v(0.000013,8.640004,14.300000);
			v(0.000002,0.000004,16.299999);
			v(0.000012,7.776004,16.299999);
			v(-5.498456,5.498472,16.299999);
			v(-7.775999,0.000009,16.299999);
			v(-5.498463,-5.498457,16.299999);
			v(0.000002,-7.775997,16.299999);
			v(5.498466,-5.498458,16.299999);
			v(7.776003,0.000009,16.299999);
			v(5.498462,5.498469,16.299999);

			f(16,0,1,0.180114,0.180114,0.360229,0.254720,0.254720,0.360229,-0.000000,0.000000,-1.000000);
			f(16,1,2,0.180114,0.180114,0.254720,0.360229,0.105508,0.360229,0.000000,0.000000,-1.000000);
			f(16,2,3,0.180114,0.180114,0.105508,0.360229,0.000000,0.254720,0.000000,0.000000,-1.000000);
			f(16,3,4,0.180114,0.180114,0.000000,0.254720,0.000000,0.105508,0.000000,0.000000,-1.000000);
			f(16,4,5,0.180114,0.180114,0.000000,0.105508,0.105508,0.000000,0.000000,0.000000,-1.000000);
			f(16,5,6,0.180114,0.180114,0.105508,0.000000,0.254720,0.000000,0.000000,-0.000000,-1.000000);
			f(16,6,7,0.180114,0.180114,0.254720,0.000000,0.360228,0.105508,0.000000,-0.000000,-1.000000);
			f(7,0,16,0.360228,0.105508,0.360229,0.254720,0.180114,0.180114,0.000000,0.000000,-1.000000);
			f(33,40,41,0.854107,0.845596,0.708215,0.785165,0.793677,0.699703,0.000000,0.000000,1.000000);
			f(33,39,40,0.854107,0.845596,0.708215,0.906026,0.708215,0.785165,0.000000,0.000000,1.000000);
			f(33,38,39,0.854107,0.845596,0.793677,0.991488,0.708215,0.906026,0.000000,-0.000000,1.000000);
			f(33,37,38,0.854107,0.845596,0.914538,0.991488,0.793677,0.991488,0.000000,-0.000000,1.000000);
			f(33,36,37,0.854107,0.845596,1.000000,0.906026,0.914538,0.991488,-0.000000,-0.000000,1.000000);
			f(33,35,36,0.854107,0.845596,1.000000,0.785165,1.000000,0.906026,-0.000000,0.000000,1.000000);
			f(33,34,35,0.854107,0.845596,0.914538,0.699703,1.000000,0.785165,-0.000000,0.000000,1.000000);
			f(33,41,34,0.854107,0.845596,0.793677,0.699703,0.914538,0.699703,0.000000,0.000000,1.000000);
			f(26,25,41,0.657068,0.608364,0.657480,0.474074,0.699482,0.480917,0.858062,0.355421,0.370683);
			f(26,41,40,0.657068,0.608364,0.699482,0.480917,0.699111,0.601778,0.858062,0.355421,0.370683);
			f(27,26,40,0.666189,0.703350,0.657068,0.608364,0.699111,0.601778,0.858062,-0.355421,0.370683);
			f(27,40,39,0.666189,0.703350,0.699111,0.601778,0.707320,0.687265,0.858062,-0.355420,0.370683);
			f(28,27,39,0.657480,0.246603,0.657068,0.112313,0.699111,0.118899,0.355421,-0.858062,0.370683);
			f(28,39,38,0.657480,0.246603,0.699111,0.118899,0.699482,0.239760,0.355421,-0.858062,0.370683);
			f(29,28,38,0.667184,0.341531,0.657480,0.246603,0.699482,0.239760,-0.355421,-0.858062,0.370683);
			f(29,38,37,0.667184,0.341531,0.699482,0.239760,0.708215,0.325195,-0.355421,-0.858062,0.370683);
			f(30,29,37,0.850876,0.402864,0.716586,0.402452,0.723429,0.360450,-0.858062,-0.355420,0.370683);
			f(30,37,36,0.850876,0.402864,0.723429,0.360450,0.844290,0.360821,-0.858062,-0.355420,0.370683);
			f(31,30,36,0.309494,0.473852,0.319197,0.378924,0.360229,0.395260,-0.858062,0.355422,0.370683);
			f(31,36,35,0.309494,0.473852,0.360229,0.395260,0.351495,0.480696,-0.858062,0.355421,0.370683);
			f(32,31,35,0.309082,0.608142,0.309494,0.473852,0.351495,0.480696,-0.355420,0.858062,0.370683);
			f(32,35,34,0.309082,0.608142,0.351495,0.480696,0.351124,0.601557,-0.355420,0.858062,0.370683);
			f(25,32,34,0.657480,0.474074,0.667184,0.379146,0.708215,0.395482,0.355421,0.858062,0.370683);
			f(25,34,41,0.657480,0.474074,0.708215,0.395482,0.699482,0.480917,0.355421,0.858062,0.370683);
			f(24,17,32,0.475611,0.473516,0.485315,0.378588,0.667184,0.379146,0.382684,0.923879,0.000000);
			f(24,32,25,0.475611,0.473516,0.667184,0.379146,0.657480,0.474074,0.382684,0.923879,0.000000);
			f(17,18,31,0.127213,0.607584,0.127625,0.473294,0.309494,0.473852,-0.382682,0.923880,0.000000);
			f(17,31,32,0.127213,0.607584,0.309494,0.473852,0.309082,0.608142,-0.382682,0.923880,0.000000);
			f(18,19,30,0.127625,0.473294,0.137329,0.378366,0.319197,0.378924,-0.923879,0.382684,0.000000);
			f(18,30,31,0.127625,0.473294,0.319197,0.378924,0.309494,0.473852,-0.923879,0.382684,0.000000);
			f(19,20,29,0.850318,0.584732,0.716028,0.584320,0.716586,0.402452,-0.923880,-0.382683,-0.000000);
			f(19,29,30,0.850318,0.584732,0.716586,0.402452,0.850876,0.402864,-0.923880,-0.382683,0.000000);
			f(20,21,28,0.485315,0.342089,0.475611,0.247161,0.657480,0.246603,-0.382684,-0.923880,-0.000000);
			f(20,28,29,0.485315,0.342089,0.657480,0.246603,0.667184,0.341531,-0.382684,-0.923880,0.000000);
			f(21,22,27,0.475611,0.247161,0.475199,0.112871,0.657068,0.112313,0.382683,-0.923880,0.000000);
			f(21,27,28,0.475611,0.247161,0.657068,0.112313,0.657480,0.246603,0.382683,-0.923880,0.000000);
			f(22,23,26,0.484320,0.702792,0.475199,0.607806,0.657068,0.608364,0.923880,-0.382683,0.000000);
			f(22,26,27,0.484320,0.702792,0.657068,0.608364,0.666189,0.703350,0.923880,-0.382683,0.000000);
			f(23,24,25,0.475199,0.607806,0.475611,0.473516,0.657480,0.474074,0.923879,0.382684,0.000000);
			f(23,25,26,0.475199,0.607806,0.657480,0.474074,0.657068,0.608364,0.923879,0.382684,0.000000);
			f(9,8,23,0.432976,0.615137,0.433434,0.465926,0.475199,0.607806,0.844559,0.349828,0.405388);
			f(8,24,23,0.433434,0.465926,0.475611,0.473516,0.475199,0.607806,0.844559,0.349828,0.405388);
			f(10,9,23,0.443110,0.720677,0.432976,0.615137,0.475199,0.607806,0.844560,-0.349828,0.405389);
			f(10,23,22,0.443110,0.720677,0.475199,0.607806,0.484320,0.702792,0.844560,-0.349828,0.405388);
			f(11,10,21,0.433434,0.254751,0.432976,0.105540,0.475611,0.247161,0.349828,-0.844559,0.405388);
			f(10,22,21,0.432976,0.105540,0.475199,0.112871,0.475611,0.247161,0.349828,-0.844559,0.405388);
			f(12,11,20,0.444216,0.360227,0.433434,0.254751,0.485315,0.342089,-0.349828,-0.844559,0.405389);
			f(11,21,20,0.433434,0.254751,0.475611,0.247161,0.485315,0.342089,-0.349828,-0.844559,0.405388);
			f(13,12,20,0.857649,0.626956,0.708438,0.626498,0.716028,0.584320,-0.844560,-0.349828,0.405388);
			f(13,20,19,0.857649,0.626956,0.716028,0.584320,0.850318,0.584732,-0.844560,-0.349828,0.405388);
			f(14,13,19,0.085447,0.465704,0.096229,0.360229,0.137329,0.378366,-0.844559,0.349829,0.405388);
			f(14,19,18,0.085447,0.465704,0.137329,0.378366,0.127625,0.473294,-0.844559,0.349829,0.405388);
			f(15,14,18,0.084990,0.614915,0.085447,0.465704,0.127625,0.473294,-0.349827,0.844560,0.405388);
			f(15,18,17,0.084990,0.614915,0.127625,0.473294,0.127213,0.607584,-0.349827,0.844560,0.405388);
			f(8,15,17,0.433434,0.465926,0.444216,0.360450,0.485315,0.378588,0.349828,0.844559,0.405388);
			f(8,17,24,0.433434,0.465926,0.485315,0.378588,0.475611,0.473516,0.349828,0.844559,0.405388);
			f(8,0,15,0.095124,0.720455,0.022377,0.720232,0.084990,0.614915,0.382684,0.923879,-0.000001);
			f(0,7,15,0.022377,0.720232,0.012242,0.614692,0.084990,0.614915,0.382683,0.923880,-0.000002);
			f(6,14,7,0.012700,0.465481,0.085447,0.465704,0.012242,0.614692,-0.382684,0.923880,-0.000001);
			f(14,15,7,0.085447,0.465704,0.084990,0.614915,0.012242,0.614692,-0.382682,0.923880,0.000002);
			f(5,13,6,0.857426,0.699703,0.857649,0.626956,0.962966,0.689569,-0.923880,0.382683,-0.000001);
			f(13,14,6,0.857649,0.626956,0.963189,0.616821,0.962966,0.689569,-0.923879,0.382684,0.000001);
			f(4,12,5,0.708215,0.699245,0.708438,0.626498,0.857426,0.699703,-0.923880,-0.382683,-0.000000);
			f(12,13,5,0.708438,0.626498,0.857649,0.626956,0.857426,0.699703,-0.923880,-0.382683,0.000001);
			f(3,11,4,0.360686,0.254974,0.433434,0.254751,0.371468,0.360450,-0.382684,-0.923880,0.000000);
			f(11,12,4,0.433434,0.254751,0.444216,0.360227,0.371468,0.360450,-0.382684,-0.923880,0.000000);
			f(2,10,11,0.360229,0.105763,0.432976,0.105540,0.433434,0.254751,0.382683,-0.923880,0.000000);
			f(2,11,3,0.360229,0.105763,0.433434,0.254751,0.360686,0.254974,0.382683,-0.923880,-0.000000);
			f(1,9,10,0.370363,0.000223,0.443110,0.000000,0.432976,0.105540,0.923880,-0.382683,0.000001);
			f(1,10,2,0.370363,0.000223,0.432976,0.105540,0.360229,0.105763,0.923880,-0.382684,-0.000000);
			f(0,8,9,0.360686,0.465703,0.433434,0.465926,0.432976,0.615137,0.923879,0.382684,0.000000);
			f(0,9,1,0.360686,0.465703,0.432976,0.615137,0.360229,0.614914,0.923880,0.382684,-0.000001);

			this.x = 0.000000;
			this.y = 0.000000;
			this.z = 0.000000;

			this.rotateX = 0.000000;
			this.rotateY = 0.000000;
			this.rotateZ = 0.000000;

			this.scaleX = 1.000000;
			this.scaleY = 1.000000;
			this.scaleZ = 1.000000;
			return (l);
		}
	}
}